package com.example.uaa;

import lombok.Data;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author MoodA
 */
@RestController
@RequestMapping("/api")
public class UserController {
    
    @Data
    static class ProFile {
        
        private String gender;
        
        private String idNumber;
    }
    
    @GetMapping("/greeting")
    public String greeting() {
        return "hello word";
    }
    
    @PostMapping("/greeting")
    public String makeGreeting(
            @RequestBody ProFile proFile) {
        return proFile.getIdNumber()+ "! \n" + proFile.getGender();
    }
    
    @PutMapping("/greeting/{name}")
    public String putGreeting(@PathVariable(value = "name") String name) {
        return name;
    }
}
